package com.hluck.calculatertest.ui.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.activityViewModels
import androidx.navigation.Navigation
import com.hluck.calculatertest.R
import com.hluck.calculatertest.databinding.FragmentTitleBinding
import com.hluck.calculatertest.ui.viewmodels.MyViewModel


class TitleFragment : Fragment() {

    private val viewModel:MyViewModel by activityViewModels()
    private lateinit var mBinding:FragmentTitleBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

    }

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_title, container, false)
        mBinding.viewmodel = viewModel

        mBinding.btnTitle.setOnClickListener {
            val controller = Navigation.findNavController(it)
            controller.navigate(R.id.action_titleFragment_to_questionFragment)
        }

        return mBinding.root
    }


}